<xsl:stylesheet version="2.0" xmlns:foo="http://something" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:import href="/apps/engine/utils/translate_fct.xsl"/>
	<xsl:variable name="dict" select="doc('input:translation')/translation"/>
	<xsl:template match="/">
		<content>
			<h1>
				<xsl:value-of select="foo:translate('Categories Management', $dict)"/>
			</h1>
			<form class="add_form" id="add_category" enctype="multipart/form-data" action="../action/createCategory" method="post">
				<fieldset>
					<legend>
						<xsl:value-of select="foo:translate('Create a new category', $dict)"/>:</legend>
					<div class="form_line">
						<label for="category_name">
							<xsl:value-of select="foo:translate('Category name', $dict)"/> : </label>
						<input class="text" type="text" id="category_name" name="category" maxlength="40"/>
					</div>

					<div class="submit">
						<input class="button" type="submit" value="{foo:translate('Create', $dict)}"/>
						<input class="button" type="reset" value="{foo:translate('Cancel', $dict)}"/>
					</div>
				</fieldset>
			</form>
			<xsl:apply-templates select="/list/category[@id != '0']"/>
		</content>
	</xsl:template>
	<xsl:template match="category">
		<div>
			<xsl:attribute name="class">item <xsl:if test="(position() mod 2)= 0">even</xsl:if>
				<xsl:if test="(position() mod 2)!= 0">odd</xsl:if>
			</xsl:attribute>
			<div class="name">
				<xsl:value-of select="name"/>
			</div>
			<div class="control">
				<a href="#" id="e_{@id}" class="editOption control controlImage" title="{foo:translate('Edit Category', $dict)}">
					<img alt="{foo:translate('Edit Category', $dict)}" src="../../views/img/admin-categories-edit.png"/>
				</a>
				<a href="#" id="d_{@id}" class="deleteOption control controlImage" title="{foo:translate('Delete Category', $dict)}">
					<img alt="{foo:translate('Delete Categories', $dict)}" src="../../views/img/admin-categories-delete.png"/>
				</a>
			</div>
		</div>
		
		<div id='editContainer_{@id}' class='edit container' style='display: none;'>
			<form class="form_container" enctype="multipart/form-data" action="../action/editCategory" method="post">
				<div class="edit_message">
					<xsl:value-of select="foo:translate(concat('Modify the name of the ''',name,''' category.'), $dict)"/>:</div>
				<div class="form_line"><label><xsl:value-of select="foo:translate('Category name', $dict)"/> : </label><input class="text" type="text" name="categoryName" maxlength="40" value="{name}"/></div>
		
				<input name="categoryId" type="hidden" value="{@id}"/>
				<input class="button" type="submit" value="{foo:translate('Edit', $dict)}"/>
				<input class="button" type="reset" value="{foo:translate('Cancel', $dict)}"/>
			</form>
		</div>
		<div id="deleteContainer_{@id}" class="delete container" style="display: none;">
			<form class="form_container" action="../action/deleteCategory" method="post">
				<div class="form_line">
					<xsl:value-of select="foo:translate(concat('Are you sure you want to delete the ''',name,''' category ?'), $dict)"/>
				</div>
				<input name="categoryId" type="hidden" value="{@id}"/>
				<input class="button" type="submit" value="{foo:translate('Delete', $dict)}"/>
				<input class="button" type="reset" value="{foo:translate('Cancel', $dict)}"/>
			</form>
		</div>
	</xsl:template>

</xsl:stylesheet>